import http from "@/utils/http";

/**
 * 根据用户id获取分类信息
 * @param {number} id
 * @returns
 */
export const getCategoryAPI = id => {
  return http.get(`/category?id=${id}`);
};

/**
 * 添加分类
 * @param {*} data
 * @returns
 */
export const addCategoryAPI = data => {
  return http.post(`/category`, data);
};

/**
 * 修改分类
 * @param {*} data
 * @returns
 */
export const updateCategoryAPI = data => {
  return http.put(`/category`, data);
};

/**
 * 删除分类
 * @param {number} id
 * @returns
 */
export const deleteCategoryAPI = id => {
  return http.delete(`/category?id=${id}`);
};
